package com.withyou.euraka.provide.aspect;
import lombok.extern.slf4j.Slf4j;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;
//@Aspect 定义一个切面 包含切点和增加
@Aspect
@Slf4j
@Component
public class AspectLog {

	//1.定义切点
	@Pointcut("execution(public * com.withyou.euraka.provide.task.*.*(..))")
	public void logAspect(){}
	
	
	//2.定义增强
	 /**
     * 环绕通知
     */
    @Around(value = "logAspect()")
    public void arround(ProceedingJoinPoint pjp) {
        try {
            log.info("1、Around：方法环绕开始.....");
            pjp.proceed();
            log.info("3、Around：方法环绕结束，结果是 :");
        } catch (Throwable e) {
            log.error(pjp.getSignature() + " 出现异常： ", e);
        }
    }
}
